function config = getFileLists( config )

    dataset_n  = length( config.datasets );

    for dataset_i = 1: dataset_n

        config.datasets{ dataset_i }  = ...
            getFileList( config.datasets{ dataset_i } );

    end

end

function config = getFileList( config )
%config of one dataset
%scan the path, add the file list

    veb = 1;

    src_format = [ config.src_root '*.' config.src_type ];
    path = dir( src_format );
    
        
    if veb, fprintf('%s : %d src img ', config.name, length(path) ); end
    
    j = 0;
    
    for i = 1:length(path)
        fname = path(i).name;
        fname = fname( 1:end-length( config.src_type )-1);
        gt_name = config.gt_format( fname );
        
        try_scan = dir( [config.gt_root gt_name ] );
        if isempty(try_scan)
            if(0 && veb)
                fprintf('warning! gt unfound %s in %s\n',...
                    gt_name , config.gt_root);
            end
            continue;
        end
        
        j = j+1;
        config.src_list{j} = [fname '.' config.src_type];
        config.gt_list{j} = gt_name;                
    end
    
    if veb, fprintf('%d mask \n', j ); end        	
end